const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: './src/main.js',
    output: {
        filename: 'bundle.js',
        path: path.join(__dirname, 'output'),
        publicPath: ''
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    'css-loader'
                ]
            },
            {
                test: /\.less$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'less-loader'
                ]
            },

            {
                test: /\.(png|jpe?g|gif)$/i,
                // use: 'file-loader'
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            //     name: './[name].[ext]',
                            esModule: false
                        }
                    }
                ]
            },
            {
                test: /\.vue$/,
                use: [
                    // 'vue-template-compiler-loader',
                    'vue-loader',
                    // 'vue-template-loader', 
                    // // 'vue-template-compiler',
                ]
            },
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            templateParameters: {
                BASE_URL: './public/',
            },
            options: {
                title: 'Webpack Plugin Sample'
            },
            template: './public/index.html'
        }),
        new VueLoaderPlugin()
    ]
}